<template>
  <div class="teacherDiv">
    <div class="box_top">
      <div class="first">
        <div class="nav">
          <p class="title">
            <span class="ico">
              <van-icon name="arrow-left" @click="goback" />
            </span>
            <span class="txt" style="margin-left: 2.55rem">讲师详情</span>
          </p>
        </div>

        <!-- 讲师介绍 -->
        <div class="teacher_recom">
          <div class="teacher_card">
            <img :src="topTeacher.avatar" alt />
            <div class="teacher_name">
              <div class="top">
                {{topTeacher.real_name}}
                <span class="dj">M13</span>
              </div>
              <div class="sex">女 7年教龄</div>
            </div>
            <div class="teacher_follow">
              <p>
                <span class="follower" v-show="isshow" @click="follow">关注</span>
                <span v-show="areshow" @click="notfollow" style="color:lightgray">已关注</span>
              </p>
            </div>
          </div>
        </div>
      </div>

      <!-- 中间 -->
      <div class="tab">
        <van-tabs
          v-model="active"
          title-active-color="#eb6100"
          line-width="15px"
          line-height="2.5px"
        >
          <van-tab style="background: white" title="讲师介绍">
            <div class="teacher_year">
              教学年龄
              <span>25年</span>
            </div>
            <br />
            <br />
            <div class="teacher_year">
              授课价格
              <span>400学习币</span>
            </div>
            <br />
            <br />
            <div class="teacher_year bb">
              老师简介
              <div class="text">{{teacherInfo.intro}}</div>
            </div>
          </van-tab>
          <van-tab title="主讲课程">
            <div class="main">
              <div
                class="course"
                @click="lessondetails"
                v-for="(item,index) in TeachermainLesson"
                :key="index"
              >
                <ul>
                  <li class="tit">{{item.title}}</li>
                  <li class="hour">共1课时</li>
                  <li class="teacher">
                    <img :src="item.cover_img" alt />
                    <span>廖天金</span>
                  </li>
                  <li class="del">
                    <span class="apply">{{item.sales_num}}人已报名</span>
                    <span class="cost">免费</span>
                  </li>
                </ul>
              </div>
            </div>
          </van-tab>
          <van-tab title="学员评价">
            <van-empty description="暂无评论" />
          </van-tab>
        </van-tabs>
        <div class="zz"></div>
      </div>
    </div>
    <!-- 导航栏 -->

    <!-- 底部 -->
    <div class="bottom">
      <p @click="goyuyue">立即预约</p>
    </div>
  </div>
</template>

<script>
import { ywtGetTeacher, ywtGetTeacherInfo, ywtGetMainLesson } from "../../util/http";
export default {
  data() {
    return {
      activeNames: ["1"],
      value: 5,
      isshow: true,
      areshow: false,
      topTeacher: [], //顶部老师介绍
      teacherInfo: [], //讲师介绍
      TeachermainLesson: [], //主讲课程
      active:"",
    };
  },
  async mounted() {
    //讲师详情页
    var res = await ywtGetTeacher(this.$route.query.id);
    console.log(res);
    this.topTeacher = res.data.data.teacher;

    // 讲师介绍
    var info = await ywtGetTeacherInfo(this.$route.query.id);
    console.log(info);
    this.teacherInfo = info.data.data;

    // 主讲课程
    var mainLesson = await ywtGetMainLesson();
    console.log(mainLesson);
    this.TeachermainLesson = mainLesson.data.data.list;
  },
  methods: {
    goback() {
      this.$router.go(-1);
    },
    follow() {
      this.$toast.success("已关注");
      this.areshow = true;
      this.isshow = false;
    },
    notfollow() {
      this.$toast.fail("取消关注");
      this.areshow = false;
      this.isshow = true;
    },
    goyuyue() {
      this.$router.push({
        path: "/orderitem"
      });
    },
  
  }
};
</script>

<style scoped>
.first {
  width: 100%;
  height: 26.66667vw;
}
.teacherDiv {
  width: 100%;

  background: #f0f2f5;
}

.van-icon {
  margin-top: 0.25rem;
  margin-left: 0.22rem;
}
.nav {
  width: 100%;
  height: 26.66667vw;
  background: linear-gradient(180deg, #63b7fe, #4e7de3);
  color: white;
  font-size: 4.8vw;
  margin-top: -0.4rem;
}
.teacher_recom {
  width: 94.66667vw;
  margin: -15.2vw auto 0;
  background: white;
  font-size: 0.32rem;
  border-radius: 1.06667vw;
}
.teacher_card {
  width: 90%;
  height: 2rem;
  margin-left: 5%;
  display: flex;
  align-items: center;
}
.teacher_name {
  margin-left: 0.2rem;
}
.teacher_card img {
  width: 10.66667vw;
  height: 10.66667vw;
}
.dj {
  color: #ea7a2f;
  font-size: 2.93333vw;
}
.top {
  font-size: 4vw;
}
.sex {
  font-size: 3.2vw;
  color: #b7b7b7;
}
.teacher_follow p {
  float: left;
  margin-left: 1.9rem;
}
.teacher_follow p .follower {
  display: inline-block;
  width: 1.5rem;
  height: 0.7rem;
  background: #ebeefe;
  color: #ea7a2f;
  text-align: center;
  line-height: 0.7rem;
  border-radius: 0.5rem;
}
.teacher_tab {
  display: flex;
  justify-content: space-around;
  flex-direction: row;
}
/* .van-tabs{
  font-size: 12px;
} */
div >>> .van-tabs__content {
  margin-top: 0.3rem;
}
div >>> .van-tabs__wrap {
  /* font-size: 2vw; */
  height: 12vw !important;
  border-bottom: 1px solid #f1f1f1;
  /* border: 1px solid red; */
}
div >>> .van-tab {
  font-size: 4vw;
}
div >>> .van-tabs__line {
  background-color: rgb(235, 97, 0);
}
.teacher_tab span {
  display: inline-block;
  width: 1.5rem;
  height: 0.5rem;
  background: #ffe4d3;
  font-size: 0.32rem;
  color: #ea7a2f;
  text-align: center;
  line-height: 0.5rem;
  border-radius: 0.5rem;
}

.teacher_year {
  /* display: flex; */
  font-size: 3.46667vw;
  color: #8c8c8c;
  margin-left: 0.4rem;
  padding-right: 0.5rem;
}
.teacher_year span {
  display: inline-block;
  margin-left: 0.5rem;
}
.tab {
  width: 100%;
  background: white;
  /* height: 70vh; */

  /* border: 1px solid red; */
  /* overflow: scroll; */
  margin-top: 1.1rem;
}
.van-empty {
  background: white;
}
/* 主讲课程 */
.course {
  /* padding-top: 0.3rem; */
  width: 94%;
  border: 1px solid rgb(240, 238, 238);
  margin-left: 3%;
  /* height: 3rem; */
  background: white;
  border-radius: 1.33333vw;
  margin-top: 0.3rem;
}
.course ul {
  /* margin-top: 0.3rem; */
  width: 94%;
  margin-left: 3%;
}
.course ul img {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
}
.course .tit {
  font-size: 4.26667vw;
  padding-top: 0.4rem;
}
.hour {
  font-size: 3.2vw;
  color: rgba(0, 0, 0, 0.45);
  margin-top: 0.1rem;
}
.teacher {
  height: 1rem;

  border-bottom: 0.01rem solid #f5f5f5;
  display: flex;
  align-items: center;
  /* float: left; */
  /* margin-right: 0.2rem; */
  font-size: 0.3rem;
}
.teacher span {
  margin-left: 3.2vw;
  color: #979696;
}

.del {
  height: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.apply {
  font-size: 0.28rem;
  color: #979696;
}
.cost {
  font-size: 4.26667vw;
  color: rgb(80, 158, 34);
}
ul .cost img {
  width: 3.2vw;
  height: 3.7vw;
}
.cost span {
  color: #ea7a2f;
  font-size: 2.93333vw;
  margin-left: 0.1rem;
}

.main {
  width: 100%;
  background: white;
}
.lesson_main {
  width: 90%;
  height: 4rem;
  margin-left: 5%;
  margin-top: 2%;
  border-bottom: 0.05rem solid lightgray;
  background: white;
  border-radius: 0.3rem;
}
.main_teacher {
  display: flex;
  justify-content: flex-start;
}
.main_teacher img {
  width: 0.5rem;
  height: 0.5rem;
}
/* .bb{
  display: flex;
} */
.text {
  line-height: 0.7rem;
  margin-left: 1.7rem;
  margin-top: -0.5rem;
}
.box {
  width: 100%;
  height: 5rem;
  background: white;
}
.box p {
  text-align: center;
}
.empty {
  width: 80%;
  height: 3rem;
  margin-left: 25%;
}
.suggest {
  display: inline-block;
  width: 2rem;
  height: 0.5rem;
  color: #ea7a2f;
  font-size: 24px;
  text-align: center;
  line-height: 0.5rem;
  border: 0.02rem solid #ea7a2f;
  margin-left: 0.04rem;
  margin-top: 0.09rem;
}
.right_icon {
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  background: lightgray;
  border-radius: 50%;
  color: white;
  text-align: center;
  line-height: 0.4rem;
}

.student_grade {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  background: white;
}
.student_grade img {
  width: 0.6rem;
  height: 0.6rem;
}
.grade_span span {
  display: inline-block;
  width: 1.5rem;
  height: 0.5rem;
  background: #f5f5f5;
  /* font-size: 24px; */
  text-align: center;
  line-height: 0.5rem;
  color: lightgray;
  margin-left: 0.32rem;
  margin-top: 0.5rem;
}
.box_top {
  height: 93vh;
  overflow: scroll;
  /* border: 1px solid red; */
}

/* 底部预约 */
.bottom {
  width: 100%;
  height: 7vh;
  margin-top: -0.4rem;
  /* position: absolute; */
  /* bottom:0rem; */
}
.bottom p {
  width: 100%;
  height: 100%;
  background: #ea7a2f;
  text-align: center;
  line-height: 7vh;
  font-size: 0.35rem;
  color: white;
}
</style>
